/**
 * 
 */
package jvs;

import java.util.Hashtable;
import java.util.Map;

import jvs.vfs.sec.AccessControl;

/**
 * JVS Open System
 * 
 * @author qiangli
 * 
 */
final public class OS {
	public static String copyright = "Copyright &copy; 2009, all rights reserved.";
	
	public static String name = "Open System";
	
	public static String version = "v0.1a";
	
	public static String applink = "";

	//private static FileSystem fs = FileSystem.getFileSystem();
	
	private static Map<Object, Object> context = new Hashtable<Object, Object>();

	private static boolean publicAccessAllowed;
	
	private static boolean buddyAccessAllowed;
	
	private static boolean adminAccessAllowed;
	
	private static int maxConnection = 16;

	private static AccessControl accessControl;
	
	public static Map<Object, Object> getContext() {
		return context;
	}
	
	public static boolean isPublicAccessAllowed() {
		return publicAccessAllowed;
	}

	public static void setPublicAccessAllowed(boolean publicAccessAllowed) {
		OS.publicAccessAllowed = publicAccessAllowed;
	}

	public static boolean isBuddyAccessAllowed() {
		return buddyAccessAllowed;
	}

	public static void setBuddyAccessAllowed(boolean buddyAccessAllowed) {
		OS.buddyAccessAllowed = buddyAccessAllowed;
	}

	public static boolean isAdminAccessAllowed() {
		return adminAccessAllowed;
	}

	public static void setAdminAccessAllowed(boolean adminAccessAllowed) {
		OS.adminAccessAllowed = adminAccessAllowed;
	}

	public static void setAttribute(Object key, Object value) {
		context.put(key, value);
	}
	
	public static Object getAttribute(Object key) {
		return context.get(key);
	}
	
//	public static java.io.File getCacheDirectory() {
//		return fs.getCacheDirectory();
//	}
//	
//	public static void setCacheDirectory(java.io.File dir) {
//		fs.setCacheDirectory(dir);
//	}

	public static int getMaxConnection() {
		return maxConnection;
	}

	public static void setMaxConnection(int maxConnection) {
		OS.maxConnection = maxConnection;
	}

	public static void setAccessControl(AccessControl accessControl) {
		OS.accessControl = accessControl;
	}

	public static AccessControl getAccessControl() {
		return accessControl;
	}
}
